package com.rytx.system.service.impl;

import com.rytx.system.domain.ysp.ArtCollection;
import com.rytx.system.mapper.ArtCollectionMapper;
import com.rytx.system.service.ArtCollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArtCollectionServiceImpl implements ArtCollectionService {

    @Autowired
    private ArtCollectionMapper artCollectionMapper;

    @Override
    public List<ArtCollection> getAllArtCollections() {
        return artCollectionMapper.selectAll();
    }

    @Override
    public ArtCollection getArtCollectionById(Long id) {
        return artCollectionMapper.selectById(id);
    }

    @Override
    public ArtCollection createArtCollection(ArtCollection artCollection) {
        artCollectionMapper.insert(artCollection);
        return artCollection;
    }

    @Override
    public ArtCollection updateArtCollection(Long id, ArtCollection artCollection) {
        artCollection.setId(id);
        artCollectionMapper.update(artCollection);
        return artCollection;
    }

    @Override
    public int deleteArtCollection(Long id) {
        return artCollectionMapper.deleteById(id);
    }

    @Override
    public List<ArtCollection> getArtCollectionsByUserId(Long userid) {
        return artCollectionMapper.selectByUserId(userid);
    }

    @Override
    public int deleteArtCollectionByIds(List<Long> list) {
        return artCollectionMapper.deleteByIds(list);
    }
}
